package com.xmu.makerspace.domain;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * Created by status200 on 2017/9/1.
 */
public class SeatPK implements Serializable {
    private Integer roomNo;
    private Integer seatNo;

    @Column(name = "room_no", nullable = false)
    @Id
    public Integer getRoomNo() {
        return roomNo;
    }

    public void setRoomNo(Integer roomNo) {
        this.roomNo = roomNo;
    }

    @Column(name = "seat_no", nullable = false)
    @Id
    public Integer getSeatNo() {
        return seatNo;
    }

    public void setSeatNo(Integer seatNo) {
        this.seatNo = seatNo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SeatPK seatPK = (SeatPK) o;

        if (roomNo != null ? !roomNo.equals(seatPK.roomNo) : seatPK.roomNo != null) return false;
        if (seatNo != null ? !seatNo.equals(seatPK.seatNo) : seatPK.seatNo != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = roomNo != null ? roomNo.hashCode() : 0;
        result = 31 * result + (seatNo != null ? seatNo.hashCode() : 0);
        return result;
    }
}
